<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Css Scroll Snap</title>
    <style>
    .gallery {
        width: 400px;
        height: 300px;
    }
    .gallery-box {
        display: flex;
        width: 100%;
        height: 100%;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
    }
    .card {
        display: flex;
        min-width: 90%;
        min-height: 100%;
        color: #333;
        font-size: 3em;
        justify-content: center;
        align-items: center;
        background-color: yellow;
        scroll-snap-align: center;
    }
    .card:nth-child(even) {
        background-color: yellowgreen;
    }
    </style>
</head>
<body>
    <section class="gallery">
        <main class="gallery-box">
            <div class="card">1</div>
            <div class="card">2</div>
            <div class="card">3</div>
            <div class="card">4</div>
            <div class="card">5</div>
        </main>
        <button class="prev"><</button>
        <button class="next">></button>
    </section>
</body>
</html>